package com.bdhub.handld;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;


public class WritetHandler extends ChannelOutboundHandlerAdapter
{
//	private Queue<MessageProto.Message> queue = null;
	//private MessageProto.Message.Builder msg = null;
	
	// private static Log log = LogFactory.getLog(WritetHandler.class);
	
	public WritetHandler()
	{
		super();
		
//		queue = q;
	}
	
	public void write(ChannelHandlerContext ctx, Object m, ChannelPromise promise) throws Exception
	{
		super.write(ctx, m, promise);
		//msg = (MessageProto.Message.Builder) m;
//		System.out.println("[Write CallBack] " + msg.build().getHead().getType() + " " + msg.build().toString());
	}
	
//	public void writeTimedOut(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception
//	{
//		System.out.println("timeout");
//		super.writeTimedOut(ctx);
//		//build message
//		UUID uuid = UUID.randomUUID();
//		
//		Map<String, Object> map = new HashMap<String, Object>();
//		map.put("type", "3003");
//		map.put("mid", uuid);
//		map.put("status", "-1");
//		
//		String strjson = JSON.toJSONString(map);
//		Head.Builder head = Head.newBuilder();
//		head.setType(3002);
//		head.setFromId(ClientBootstrap.getInstance().getFmid());
//		head.setComments(strjson);
//		
//		Message.Builder msg = Message.newBuilder();
//		msg.setHead(head);
//		msg.setBody(msg.getHead().getMid());
//		//
//		queue.offer(msg.build());
//	}
	
}
